$(()=>{
    //渲染出生日期
    layui.use(function () {
        const laydate = layui.laydate;
        laydate.render({
            elem: "#birthday",
            type: "date"
        });
    });
})
function submitAdd(cb=$.noop){
    let cardId=$("#cardId").val();
    let name=$("#name").val();
    let pinyin=$("#pinyin").val();
    let phone=$("#phone").val();
    let birthday=$("#birthday").val();
    let weixin=$("#weixin").val();
    let sex=$(":input[name=sex]:checked").val();
    // console.log(cardId,name,sex,phone,pinyin,weixin)
    if (cardId.trim()===""){
        layer.msg("请输入学号");
        return;
    }
    if (name.trim()===""){
        layer.msg("请输入姓名");
    }
    //可以继续判断手机号、出生日日期的格式
    $.ajax({
        url:ctx+"/admin/student/add",
        method:"POST",
        data:{
            cardId,
            name,
            sex,
            phone,
            pinyin,
            weixin,
            birthday
        },
        success:function(data){
          cb(data.success)
        }
    })

}